#!/usr/bin/env python3
#-*- coding: utf-8 -*-

from net.core.request import request
import time
'''
net.WS_handle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Client句柄
'''
class ws_request(request):
    def __init__(self,connection,address,handle):
        '''
        Feature
            __init__(self,connection,address,handle)
        Description
            初始化
        Args
            connection
                type:socket
                description:client socket句柄
            address
                type:ip address ("127.0.0.1",3000)
                description:client ip address
            handle
                type:WS_Server
                description:server 句柄
        '''
        super(ws_request,self).__init__(connection,address,handle)
    
    def run(self):
        '''
        Feature
            run(self)
        Description
            客户端处理线程
        '''
        #print("{0} - {1} has connected server".format(time.strftime("%YY-%m-%d %H:%M:%S",time.localtime()),self._connect))
        while  True:
            data = self._connect.recv(1024)
            if len(data)==0:
                continue
            print(str(self._address)+":"+data.decode())